<?php
/**
 * Author: Administrator
 * Date: 2022/7/23 15:19
 */

namespace DesignPatterns\Behavioral\ChainOfResponsibilities;


class SlowStorage extends Handler
{
    protected $storage;
    public function __construct($data)
    {
        $this->storage = $data;
    }

    public function process(Request $request)
    {
        if ($request->method == 'get') {
            if (array_key_exists($request->key, $this->storage)) {
                $request->response = $this->storage[$request->key];
                return true;
            }
        }
        return false;
    }
}